/**
 * Copyright (C), 2019-2022, 宇信融汇
 * FileName: Account
 * Author:   666
 * Date:     2022/1/15 17:28
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 666           修改时间           版本号              描述
 */
package com.abstractdemo.after;

/**
 * @Classname Account
 * @Description 模板
 * @Date 2022/1/15 17:28
 * @Created by 666
 */
public abstract class Account {
    private String cardId;
    private double money;

    public Account() {
    }

    public Account(String cardId, double money) {
        this.cardId = cardId;
        this.money = money;
    }

    public String getCardId() {
        return cardId;
    }

    public void setCardId(String cardId) {
        this.cardId = cardId;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    /**
     * 登录结算
     */
    public void handle(String loginName, String passWord) {
        // a.判断登录是否成功
        if ("itheima".equals(loginName) && "123456".equals(passWord)) {
            System.out.println("登录成功。。");
            // b.正式结算利息
            double result = cure(); // 结算利息了
            if (money >= 100000) {
                result += money * 0.03;
            }
            // c.输出利息详情
            System.out.println("本账户利息是：" + result);
        } else {
            System.out.println("用户名或者密码错误了");
        }
    }

    public abstract double cure();
}
